<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>物联利浪-点餐系统</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!-- Loading Bootstrap -->
<link href="<%=path%>/resource/diancan/css/vendor/bootstrap.min.css"
	rel="stylesheet">

<!-- Loading Flat UI -->
<link href="<%=path%>/resource/diancan/css/flat-ui.css" rel="stylesheet">
<link href="<%=path%>/resource/diancan/css/my.css" rel="stylesheet">
<link
	href="<%=path%>/resource/diancan/css/time/bootstrapv3-datetimepicker.min.css"
	rel="stylesheet">

<link rel="shortcut icon"
	href="<%=path%>/resource/diancan/img/favicon.ico">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
      <script src="<%=path%>/resource/diancan/js/vendor/html5shiv.js"></script>
      <script src="<%=path%>/resource/diancan/js/vendor/respond.min.js"></script>
    <![endif]-->
</head>
<body>

	<div class="container body">
		<div class="row" id="error_alert">
			<div class="alert alert-danger alert-dismissible" role="alert">
				<button type="button" class="close" data-dismiss="alert">
					<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
				</button>
				<strong>错误!</strong> ${error }
			</div>
		</div>
		
		<div class="row">
			<h1 class="demo-logo">
				<span class="logo"></span> 物联利浪<small>点餐系统</small>
			</h1>
		</div>

		<!-- Nav tabs -->
		<ul class="nav nav-tabs" role="tablist">
			<li class="active"><a href="#add" role="tab" data-toggle="tab">新开轮次</a></li>
			<li><a href="#update" role="tab" data-toggle="tab">修改当前轮次</a></li>
		</ul>

		<!-- Tab panes -->
		<div class="tab-content">
			<div class="tab-pane active" id="add">
				<div class="row">
					<form action="<%=path%>/diancan/newBout" method="post">
						<div class="form-group">
							<label class="login-field-icon fui-user" for="business">商家</label>
							<select class="form-control" data-toggle="select" tabindex="-1"
								title="" name="admin.newBout.business.id">
								<c:forEach items="${admin.business}" var="bus">
									<option value="${bus.id}">${bus.name}</option>
								</c:forEach>
							</select>
						</div>
						<div class="form-group">
							<label class="login-field-icon fui-calendar" for="startTime">开始时间</label>
							<div class='input-group date' id="startTime">
								<input type='text' class="form-control" id="startTime"
									name="admin.newBout.startTime" value="${admin.startTime}" /> <span
									class="input-group-addon"> <span
									class="glyphicon glyphicon-calendar"></span>
								</span>
							</div>
						</div>
						<div class="form-group">
							<label class="login-field-icon fui-calendar" for="endTime">结束时间</label>
							<div class='input-group date' id="endTime">
								<input type='text' class="form-control" id="endTime"
									name="admin.newBout.endTime" value="${admin.endTime}" /> <span
									class="input-group-addon"> <span
									class="glyphicon glyphicon-calendar"></span>
								</span>
							</div>
						</div>
						<button type="submit" class="btn btn-block btn-lg btn-info">新开轮次</button>
					</form>
				</div>
			</div>
			<div class="tab-pane" id="update">
				<!-- 修改 -->
				<c:if test="${bout!=null }">
					<div class="row">
						<form action="<%=path%>/diancan/newBout" method="post">
							<div class="form-group">
								<label class="login-field-icon fui-user" for="business">商家</label>
								<p class="form-control-static">${bout.business.name }</p>
							</div>
							<div class="form-group">
								<label class="login-field-icon fui-calendar" for="startTime">开始时间</label>
								<p class="form-control-static">${bout.startTime }</p>
							</div>
							<div class="form-group">
								<label class="login-field-icon fui-calendar" for="endTime">结束时间</label>
								<div class='input-group date' id="endTime">
									<input type='text' class="form-control" id="endTime"
										name="admin.newBout.endTime" value="${bout.endTime}" /> <span
										class="input-group-addon"> <span
										class="glyphicon glyphicon-calendar"></span>
									</span>
								</div>
							</div>
							<input type="hidden" name="admin.newBout.id" value="${bout.id }" />
							<button type="submit" class="btn btn-block btn-lg btn-info">修改轮次</button>
						</form>
					</div>
				</c:if>
				<c:if test="${bout==null }">
					<h3>当前无正在使用中的轮次</h3>
				</c:if>
			</div>
		</div>
	</div>

	<div class="container footer">
		<div class="row">
			<h4 class="center">©2014 物联利浪科技 研发部技术支持</h4>
		</div>
	</div>
	<!-- jQuery (necessary for Flat UI's JavaScript plugins) -->
	<script src="<%=path%>/resource/diancan/js/vendor/jquery.min.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="<%=path%>/resource/diancan/js/flat-ui.min.js"></script>
	<script src="<%=path%>/resource/diancan/js/time/moment.js"></script>
	<script
		src="<%=path%>/resource/diancan/js/time/bootstrapv3-datetimepicker.min.js"></script>
	<script
		src="<%=path%>/resource/diancan/js/time/bootstrap-datetimepicker.zh-CN.js"></script>
	<script type="text/javascript">
		$(function() {
			if ("${error}" == "") {
				$("#error_alert").hide();
			}

			var format = "YYYY-MM-DD HH:mm:ss";
			$('#startTime').datetimepicker({
				format : format,
				language : "zh-CN"
			});
			$('#endTime').datetimepicker({
				format : format,
				language : "zh-CN"
			});
		});
	</script>
</body>
</html>
